﻿<!DOCTYPE HTML>
<html>
<head>
    <title>Empleo en tu bolsillo</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <!-- FontAwesome - http://fortawesome.github.io/Font-Awesome/ -->
    <link rel="stylesheet" href="css/font-awesome.min.css" />
    <!-- jQueryMobileCSS - original without styling -->
    <link rel="stylesheet" href="css/jquerymobile.css" />
    <!-- nativeDroid core CSS -->
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.css" />
    <!-- nativeDroid: Light/Dark -->
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.light.css" id='jQMnDTheme' />
    <!-- nativeDroid: Color Schemes -->
    <link rel="stylesheet" href="css/jquerymobile.nativedroid.color.green.css" id='jQMnDColor' />
    <!-- jQuery / jQueryMobile Scripts -->
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
    <script src="js/index.js"></script>
</head>
<body>
    <div data-role="page" data-theme='b'>
        <div data-role="header" data-position="fixed" data-tap-toggle="false" data-theme='b'>
            <a href="index.html" data-ajax="false"><i class='icon-ellipsis-vertical'></i></a>
            <h1>
                Detalle de convocatoria</h1>
        </div>
       
        <div id="div_contenido" data-role="content">
            
            
        </div>
        <div style="width:100%; text-align:center; margin-top:30px;">
            <img src="images/banner.png" alt="banner" />
            </div>
    </div>
    <script type="text/javascript">
        $('document').ready(function () {
            cargar_datos();
            //configurar_db();
        });

        function cargar_datos() {
            var xmlhttp = new window.XMLHttpRequest();
            xmlhttp.open('POST', 'http://190.27.194.177:9007/OPECWS/services/OpecServiceImplPort?wsdl', true);
            var sr = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cnsc="http://cnsc/"><soapenv:Header/><soapenv:Body><cnsc:GetOpec><!--Optional:--><arg0>' + localStorage.getItem("id_seleccionada") + '</arg0></cnsc:GetOpec></soapenv:Body></soapenv:Envelope>';
            xmlhttp.setRequestHeader('Content-Type', 'text/xml');
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4) {
                    //                     
                    try { //Internet Explorer
                        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                        xmlDoc.async = "false";
                        xmlDoc.loadXML(this.responseText);
                    }
                    catch (e) {
                        try { // Firefox, Mozilla, Opera, etc.
                            parser = new DOMParser();
                            xmlDoc = parser.parseFromString(this.responseText, "text/xml");
                        }
                        catch (e) {
                            //alert(e.message);
                            return;
                        }
                    }
                    var nodes = xmlDoc.getElementsByTagName("entidad");
                    var cantidad = nodes.length;
                    $("#lista_convocatorias").html("");
                    for (var i = 0; i < cantidad; i++) {
                        //                        alert(xmlDoc.getElementsByTagName("entidad")[i].childNodes[0].nodeValue);
                        //                        alert(xmlDoc.getElementsByTagName("fechaFinalizacionInscipcion")[i].childNodes[0].nodeValue);
                        //                        alert(xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue);
                        //                        alert(xmlDoc.getElementsByTagName("numeroVacantes")[i].childNodes[0].nodeValue);
                        Texto = "<h1>" +
                xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue + " - " + xmlDoc.getElementsByTagName("entidad")[i].childNodes[0].nodeValue + "</h1>" +
            "<h3 style=\"font-weight:bold;\">" +
                "Fecha límite de inscripción:" +
            "</h3>" +
            "<p>" +
                xmlDoc.getElementsByTagName("fechaFinalizacionInscipcion")[i].childNodes[0].nodeValue + "</p>" +
            "<h3 style=\"font-weight:bold;\">" +
                "Número de vacantes:" +
            "</h3>" +
            "<p>" +
             xmlDoc.getElementsByTagName("numeroVacantes")[i].childNodes[0].nodeValue + "</p>" +
            "<h3 style=\"font-weight:bold;\">" +
             "   Número de convocatoria:" +
            "</h3>" +
            "<p>" +
             xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue + "</p>" +
            "<div style=\"text-align: right;\">" +
             "   <i class='icon-rss-sign' style=\"margin-right: 20px;\" onclick=\"VerEmpleos('" + xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue + "')\"></i><i class=\"icon-search\" onclick=\"VerNoticias('" + xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue + "')\" title=\"Ver noticias\"" +
                    "style=\"margin-right: 20px;\"></i><i class=\"icon-star\" onclick=\"FavoritosAgregar('001','fecha')\" title=\"Añadir a Favoritos\"" +
                 "   style=\"margin-right: 20px;\"></i><a target=\"_blank\" title=\"Compartir Facebook\" class=\"icon-facebook-sign\" style=\"margin-right: 20px !important;" +
                                    "color: #404040 !important;\" href=\"http://www.facebook.com/share.php?u=http://www.google.com\">" +
                                "</a><a target=\"_blank\" title=\"Compartir Facebook\" class=\"icon-twitter\" style=\"margin-right: 20px !important;" +
                                    "color: #404040 !important;\" href=\"http://www.facebook.com/share.php?u=http://www.google.com\">" +
                                "</a><i class=\"icon-star\" onclick=\"FavoritosAgregar('" + xmlDoc.getElementsByTagName("numeroConvocatoria")[i].childNodes[0].nodeValue + "','" + xmlDoc.getElementsByTagName("fechaFinalizacionInscipcion")[i].childNodes[0].nodeValue + "')\" title=\"Añadir a Favoritos\"" +
                                    "style=\"margin-right: 20px;\"></i>" +
            "</div>";

                        document.getElementById("div_contenido").innerHTML = Texto;
                    }

                }
            }


            xmlhttp.send(sr);
        }


        function FavoritosAgregar(id_convocatoria, fechafin) {

            window.convocatoria = id_convocatoria;
            window.fechafin = fechafin;
            onDeviceReady();
        }

        function VerNoticias(id_convocatoria) {
            localStorage.setItem("id_seleccionada", id_convocatoria);
            document.location.href = "Noticias.html";
        }

        function VerEmpleos(id_convocatoria) {
            localStorage.setItem("id_seleccionada", id_convocatoria);
            document.location.href = "Filtro.html";
        }

    </script>
</body>
</html>
